/*!
 * \file frstrlower.c
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 3.0
 * \author geyh
 * \date 2016/03/31
 *
 */
#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "frstr.h"
#include "conntrack.h"
#include "frct_comm.h"

#include "apmtest_comm.h"

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}


static void __case1(void)
{
    char *p_out = (char *)frstrdup((char *)"AABBCC");
    int i_ret = 0;

    i_ret = frstrlower(p_out, 6);

    CU_ASSERT_STRING_EQUAL(p_out, (char *)"aabbcc");

    frfree(p_out);
    return;
}

static void __case2(void)
{
    char *p_out = (char *)frstrdup((char *)"AAbbCC");
    int i_ret = 0;

    i_ret = frstrlower(p_out, 6);

    CU_ASSERT_STRING_EQUAL(p_out, (char *)"aabbcc");

    frfree(p_out);
    return;
}


static void __case3(void)
{
    char *p_out = (char *)frstrdup((char *)"AA11233+");
    int i_ret = 0;

    i_ret = frstrlower(p_out, 8);

    CU_ASSERT_STRING_EQUAL(p_out, (char *)"aa11233+");

    frfree(p_out);
    return;
}



int add_suite_frstrlower(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frsutl frstrlower()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);
    CU_add_test(pSuite, "case2", __case2);
    CU_add_test(pSuite, "case3", __case3);

    return FR_SUCC;
}
